k8s学习七:使用本地docker镜像仓库部署服务 | 您所在的位置:网站首页 › k8s 部署本地镜像 › k8s学习七:使用本地docker镜像仓库部署服务 |
在master节点中,通过docker 启动docker 仓库服务:docker run -d -p 5000:5000 --restart=always --name registry registry:2 没有此镜像会自动下载 更新所有节点的仓库地址所有的节点都更新/etc/docker/daemon.json,insecure-registries为本地仓库地址。这里我填的本地仓库地址为master节点的ip。 部署go的yaml文件修改 主要是指定image的地址: \-\-\- apiVersion: apps/v1 kind: Deployment metadata: name: go-deployment labels: app: go spec: selector: matchLabels: app: go replicas: 3 minReadySeconds: 5 strategy: type: RollingUpdate rollingUpdate: maxSurge: 1 maxUnavailable: 1 template: metadata: labels: app: go spec: containers: - image: 192.168.192.9:5000/tioncico/go:v1.0.1 name: go imagePullPolicy: Always command: \["./main","-v","v1.0.1"\] ports: - containerPort: 8080 protocol: TCP \-\-\- apiVersion: v1 kind: Service metadata: name: go-service labels: app: go spec: selector: app: go ports: - name: go-port protocol: TCP port: 8080 targetPort: 8080 nodePort: 30080 type: NodePort然后部署即可 |
CopyRight 2018-2019 实验室设备网 版权所有 |